home *** CD-ROM | disk | FTP | other *** search
/ Freelog 46 / Freelog046.iso / Alu / Celestia / Win32LoresTex / celestia-lores-win32-1.3.0.exe / {app} / shaders / night.vp < prev    next >
Text File  |  2002-12-22  |  1KB  |  40 lines

  1. !!VP1.0
  2.  
  3. # Compute the diffuse light from a single source
  4.  
  5. # c[0]..c[3] contains the concatenation of the modelview and projection matrices.
  6. # c[4]..c[7] contains the inverse transpose of the modelview
  7. # c[15] contains the eye position in object space
  8. # c[16] contains the light direction in object space
  9. # c[17] contains H, the normalized sum of the eye and light direction
  10. # c[20] contains the light color * object color
  11. # c[32] contains the ambient light color * object color
  12. # c[33] contains the haze color
  13. # c[40] contains (0, 1, 0, specPower)
  14.  
  15. # Transform the vertex by the modelview matrix
  16. DP4   o[HPOS].x, c[0], v[OPOS];
  17. DP4   o[HPOS].y, c[1], v[OPOS];
  18. DP4   o[HPOS].z, c[2], v[OPOS];
  19. DP4   o[HPOS].w, c[3], v[OPOS];
  20.  
  21. # Compute the diffuse light component
  22. DP3   R2, v[NRML], c[16];
  23. # Clamp the diffuse component to zero
  24. MAX   R2, R2, c[40].xxxx;
  25.  
  26. # Use the fourth power of L dot N to create a sharper division between
  27. # the lit and unlit sides of the planet.
  28. ADD   R2, c[40].y, -R2;
  29. MUL   R2, R2, R2;
  30. MAD   R2, R2, -R2, c[40].y;
  31.  
  32. # Output the texture
  33. MOV   o[TEX0], v[TEX0];
  34. # Output the primary color
  35. MOV   R0, c[32];
  36. MAD   o[COL0], c[20], R2, R0;
  37.  
  38. END
  39.  
  40.